% !TeX spellcheck = en_US
\documentclass[12pt,openany,oneside]{book}
%\documentclass{article}
\usepackage[a4paper,top=2.54cm,bottom=2.54cm,left=3.17cm,right=2.35cm]{geometry}
%\usepackage[a4paper]{geometry}
\usepackage{amsmath}
\usepackage{remreset}
\usepackage{pifont}
\usepackage{float}
\usepackage{pdfpages}
\usepackage{ccaption}

\usepackage{caption}

%导入中文支持
\usepackage[UTF8,hyperref,adobefonts]{ctexcap}
\usepackage{titlesec} 
\usepackage{longtable}
%章节编号设置
%设置PDF文件属性
%\usepackage[unicode,hidelinks,bookmarks=true,bookmarksnumbered=true]{hyperref}
\hypersetup{hidelinks,bookmarks=true,bookmarksnumbered=true,
			pdftitle={基于移动设备的 DICOM 应用系统},%
            pdfauthor={xsp@zarrapple.net},%
            pdfsubject={},%
            pdfkeywords={移动应用\ IOS\ Android\ Dicom\ PACS}
}

%\CTEXsetup[name={第,章},number={\chinese{section}}]{section}

%代码块设置
\usepackage{listings}
\lstset{
language=[AspectJ]Java,
basicstyle=\footnotesize\ttfamily,
keywordstyle=\bf ,%\underbar,
numbers=left, numberstyle=\tiny,
identifierstyle=,
commentstyle=\textit,
%stringstyle=\ttfamily,
showstringspaces=false,
captionpos=t,
frame=shadowbox,
xleftmargin=2em,xrightmargin=2em, aboveskip=1em,
escapeinside=``
}

\lstset{ tabsize=4,breakindent=40pt, breaklines}

%设置代码标题和代码目录标题
\AtBeginDocument{%
  \renewcommand\thelstlisting{\thesection.\arabic{lstlisting}}
  \renewcommand\lstlistingname{代码}
  \renewcommand\lstlistlistingname{代码列表}
  \def\lstlistingautorefname{代码.} 
  \renewcommand\thetable{\arabic{section}.\arabic{table}}
  \renewcommand\thefigure{\arabic{section}.\arabic{figure}}
}

\usepackage{fancyhdr}

% 页眉页脚
\fancypagestyle{plain}{%
	\fancyhf{}%
	\renewcommand{\headrulewidth}{0pt}%
	\renewcommand{\footrulewidth}{0pt}%
	\fancyfoot[C]{\thepage}
    %\fancyfoot[R]{\small Copyright \copyright 2003--\the\year{} }
}
\pagestyle{fancy}

\fancyhf{}
\fancyhead[L]{\small 上海交通大学工程硕士学位论文}
\fancyhead[R]{\small \leftmark}
\fancyfoot[C]{\small \thepage}
%\fancyfoot[R]{\small Copyright \copyright 2003--\the\year{} }
%\renewcommand{\thechapter}{\chinese{chapter}}
\renewcommand{\chaptermark}[1]{\markboth{\small 第\,\chinese{chapter}\,章\quad #1}{}}
%\renewcommand{\sectionmark}[1]{\markright{~\thesection~~#1~}{}} 

\fancypagestyle{plain}{

     \fancyhf{}

  \fancyhead[L]{\small 上海交通大学工程硕士学位论文}
  \fancyhead[R]{\small \leftmark}
  \fancyfoot[C]{\small \thepage}

}
 
%\usepackage{titletoc}
%\contentsuse{lstlisting}{lol}
%\titlecontents{lstlisting}[2em]
%              {\addvspace{0.25pc}}
%              {\textbf{代码 \thecontentslabel}\enspace}
%              {}
%              {\titlerule*[0.5em]{$\cdot$}\contentspage}
%              []

\usepackage{tikz,xltxtra}
\usetikzlibrary{shapes,arrows,positioning}

\usepackage{cite}

%自定义命令
%\renewcommand{\baselinestretch}{1.62}
\newcommand*{\dicom}{\textbf{DICOM}}
\newcommand*{\dcmfourche}{\textbf{DCM4CHE}}
\newcommand*{\wado}{\textbf{WADO}}

\newcommand{\javaclass}[1]{\texttt{#1}}
\newcommand{\javamethod}[1]{\texttt{#1}}
\newcommand{\javafield}[1]{\texttt{#1}}
\newcommand{\javaobject}[1]{\texttt{#1}}
\newcommand{\javacode}[1]{“\texttt{#1}”}
\newcommand{\uid}[1]{\text{\textbf{#1}}}
\newcommand{\TODO}[1]{\vspace{1ex}\textbf{//TODO:#1}\vspace{1ex} }
\newcommand{\circletext}[1]{\ding{\numexpr171+#1}}
\newcommand{\thecodecomment}{\circletext{\value{codecomment}}}
\newcommand{\codecomment}{\stepcounter{codecomment}\thecodecomment}
\newcommand{\bifigcaption}[3]{\bicaption[#1]{图}{#2}{Fig.}{#3}}
\newcommand{\bitabcaption}[3]{\bicaption[#1]{表}{#2}{Tab.}{#3}}

\captionsetup{
	labelsep=quad,% 去掉图标签后的冒号
	figurename=图,%
	tablename=表}

\newcommand{\sanhao}{\fontsize{20.75pt}{\baselineskip}\selectfont}
\newcommand{\sihao}{\fontsize{17pt}{\baselineskip}\selectfont}
\titleformat{\chapter}{\centering\sanhao\bfseries}{第\chinese{chapter}章}{1em}{}
%\titleformat{\section}[runin]{\normalfont\scshape}{\S\,\oldstylenums{\thesection}.}{.5em}{}[.\quad]

\titleformat{\section}{\sihao\bfseries}{\arabic{chapter}.\arabic{section}}{1em}{}

\begin{document}
%	\captionsetup{labelsep=space}
%	\captionsetup[table]{labelsep=space}
%	\captionsetup[figure]{labelsep=space}
%	\captionsetup[longtable]{labelsep=space}
%在每个chapter后跟新代码计数器和表格计数器
\numberwithin{table}{chapter}
\numberwithin{figure}{chapter}
\numberwithin{lstlisting}{chapter}
\newcounter{codecomment}[lstlisting]
\renewcommand{\thecodecomment}{\circletext{\value{codecomment}}}
%\makeatletter
%\@addtoreset{lstlisting}{section}
%\@removefromreset{lstlisting}{section}
%\makeatother
%\begin{CJK*}{UTF8}{gbsn}

%\title{基于移动设备的 DICOM 应用系统}
%\author{夏申频}
%\maketitle



\includepdf[pages=1-2]{header.pdf}
\includepdf[pages=1-1]{01.pdf}
\includepdf[pages=1-1]{02.pdf}

%\clearpage

\input{abstract}

%\clearpage

\tableofcontents
%\lstlistoflistings

%\clearpage

\tikzstyle{decision} = [diamond, draw, fill=blue!20,text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm,minimum height=2em]
\tikzstyle{wblock} = [rectangle, draw,text width=10em, text centered ,minimum height=4em]
\tikzstyle{rblock} = [rectangle, draw, text width=5em, text centered, minimum height=4em]


%前言
\input{Preface}
%\clearpage

%DICOM网络通信和DCM4CHE
\input{DicomNetAndDCM4CHE}
%\clearpage

%非图像数据
\input{NoImageDataReceive}
%\clearpage

%图像和图像渲染
\input{ImageReceiveAndRender}
%\clearpage

%worklist和上传
\input{WorklistAndImageStore}
%\clearpage

%总结
\input{summary}

%\clearpage
%\end{CJK*}
\end{document}